import glob
import yagmail


def Mail():
    mail = yagmail.SMTP(user='2318636512@qq.com', password='ajrsnljilowlecdd', host='smtp.qq.com', port=465)
    to = ['2318636512@qq.com', 'norma_bai@126.com']
    # to = '2318636512@qq.com'
    attachments = glob.glob('./A3mall_pytest/*.html') + glob.glob('./A3mall_pytest/*.log') + glob.glob(
        './A3mall_pytest/*.py') + glob.glob('./A3mall_pytest/*.csv') + glob.glob('./A3mall_pytest/*.json') + glob.glob(
        './A3mall_pytest/*.xlsx') + glob.glob(
        './A3mall_pytest/*.yaml') + glob.glob('./A3mall_pytest/pytest_yw1') + glob.glob(
        './A3mall_unittest/*.html') + glob.glob('./A3mall_unittest/*.log') + glob.glob(
        './A3mall_unittest/*.py') + glob.glob('./A3mall_unittest/*.csv') + glob.glob(
        './A3mall_unittest/*.json') + glob.glob('./A3mall_unittest/*.xlsx') + glob.glob(
        './A3mall_unittest/*.yaml') # + glob.glob('./WMS_pytest/*.html') + glob.glob('./WMS_pytest/*.log') + glob.glob(
        # './WMS_pytest/*.py') + glob.glob('./WMS_pytest/*.csv') + glob.glob('./WMS_pytest/*.json') + glob.glob(
        # './WMS_pytest/*.xlsx') + glob.glob(
        # './WMS_pytest/*.yaml') + glob.glob('./WMS_unittest/*.html') + glob.glob('./WMS_unittest/*.log') + glob.glob(
        # './WMS_unittest/*.py') + glob.glob('./WMS_unittest/*.csv') + glob.glob('./WMS_unittest/*.json') + glob.glob(
        # './WMS_unittest/*.xlsx') + glob.glob(
        # './WMS_unittest/*.yaml')
    mail.send(to=to, subject='高伟-A3mall+pytest项目', contents='测试各项数据', attachments=attachments)
    mail.close()


if __name__ == '__main__':
    Mail()
